package cn.yunyichina.provider.pay.executor;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by Lullaby on 2017/7/21
 */
public class PayNotifyThreadFactory implements ThreadFactory {

    private final AtomicInteger count = new AtomicInteger(0);

    private static final String PREFIX = "Pay-Notify-Thread".concat("-");

    public Thread newThread(Runnable r) {
        int index = count.incrementAndGet();

        Thread thread = new Thread(r);
        thread.setName(PREFIX + index);

        return thread;
    }

}
